//---------------------------------------------------------------------
// <copyright file="ODataEntityReferenceLink.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Data.OData
{
    #region Namespaces
    using System;
    using System.Diagnostics;
    #endregion Namespaces

    /// <summary>
    /// Represents an entity reference link (the result of a $link query).
    /// </summary>
    [DebuggerDisplay("{Url.OriginalString}")]
    public sealed class ODataEntityReferenceLink : ODataItem
    {
        /// <summary>
        /// Provides additional serialization information to the <see cref="ODataMessageWriter"/> for this <see cref="ODataEntityReferenceLink"/>.
        /// </summary>
        private ODataEntityReferenceLinkSerializationInfo serializationInfo;

        /// <summary>Gets or sets the URI representing the URL of the referenced entity.</summary>
        /// <returns>The URI representing the URL of the referenced entity.</returns>
        /// <remarks>This URL should be usable to retrieve or modify the referenced entity.</remarks>
        public Uri Url
        {
            get;
            set;
        }
        
        /// <summary>
        /// Provides additional serialization information to the <see cref="ODataMessageWriter"/> for this <see cref="ODataEntityReferenceLink"/>.
        /// </summary>
        internal ODataEntityReferenceLinkSerializationInfo SerializationInfo
        {
            get
            {
                DebugUtils.CheckNoExternalCallers();
                return this.serializationInfo;
            }

            set
            {
                DebugUtils.CheckNoExternalCallers();
                this.serializationInfo = ODataEntityReferenceLinkSerializationInfo.Validate(value);
            }
        }
    }
}
